package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

/*退货*/

@Entity
public class Tuihuo {
    private int thId;//退货id
    private String thDanhao;//退货单号
    private Timestamp thTime;//退货时间
    private BigDecimal thYingmoney;//因退款
    private BigDecimal thShimoney;//实退款
    private String thYuanyin;//退货原因
    private String thZhuangtai;//退货状态
    private String thFangshi;//退货方式
    private String thWuliugs;//退货物流公司
    private Kehu kH;//客户对象（客户Id）
    private Dingdan dingdanByDdId;//订单对象（订单id）
    private Integer thYs;
    private String thWuliuhao;//物流号
    private String thBeizhu;//备注

    private String thSh;

    private Fahuo fahuo;//发货对象

    private String thRk;//判断是否入库(z=已申请,y=已入库)
    private String thWx;//判断是否需要维修
    private Integer thWxwc;//判断是否维修完成(-1=>没有,0=>维修中,1=>成功,2=>维修失败)

    private String thPeople;

    @Column(name = "th_people")
    public String getThPeople() {
        return thPeople;
    }

    public void setThPeople(String thPeople) {
        this.thPeople = thPeople;
    }

    @Column(name = "th_wxwc")
    public Integer getThWxwc() {
        return thWxwc;
    }

    public void setThWxwc(Integer thWxwc) {
        this.thWxwc = thWxwc;
    }

    @Column(name="th_wx")
    public String getThWx() {
        return thWx;
    }

    public void setThWx(String thWx) {
        this.thWx = thWx;
    }

    @Column(name = "th_rk")
    public String getThRk() {
        return thRk;
    }

    public void setThRk(String thRk) {
        this.thRk = thRk;
    }

    @Column(name = "th_sh")
    public String getThSh() {
        return thSh;
    }

    public void setThSh(String thSh) {
        this.thSh = thSh;
    }

    //public List<Dingdanxiangqing> ddxqList;//订单详情集合
    public List<Fahuoxiangqing> fhxqList;//发货详情集合

    @Column(name = "th_beizhu")
    public String getThBeizhu() {
        return thBeizhu;
    }

    public void setThBeizhu(String thBeizhu) {
        this.thBeizhu = thBeizhu;
    }

    @Column(name = "th_wuliuhao")
    public String getThWuliuhao() {
        return thWuliuhao;
    }

    public void setThWuliuhao(String thWuliuhao) {
        this.thWuliuhao = thWuliuhao;
    }

    @Column(name = "th_ys")
    public Integer getThYs() {
        return thYs;
    }

    public void setThYs(Integer thYs) {
        this.thYs = thYs;
    }

    @Id
    @Column(name = "th_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getThId() {
        return thId;
    }

    public void setThId(int thId) {
        this.thId = thId;
    }

    @Basic
    @Column(name = "th_danhao", nullable = true, length = 200)
    public String getThDanhao() {
        return thDanhao;
    }

    public void setThDanhao(String thDanhao) {
        this.thDanhao = thDanhao;
    }

    @Basic
    @Column(name = "th_time", nullable = false)
    public Timestamp getThTime() {
        return thTime;
    }

    public void setThTime(Timestamp thTime) {
        this.thTime = thTime;
    }

    @Basic
    @Column(name = "th_yingmoney", nullable = true, precision = 2)
    public BigDecimal getThYingmoney() {
        return thYingmoney;
    }

    public void setThYingmoney(BigDecimal thYingmoney) {
        this.thYingmoney = thYingmoney;
    }

    @Basic
    @Column(name = "th_shimoney", nullable = true, precision = 2)
    public BigDecimal getThShimoney() {
        return thShimoney;
    }

    public void setThShimoney(BigDecimal thShimoney) {
        this.thShimoney = thShimoney;
    }

    @Basic
    @Column(name = "th_yuanyin", nullable = true, length = 200)
    public String getThYuanyin() {
        return thYuanyin;
    }

    public void setThYuanyin(String thYuanyin) {
        this.thYuanyin = thYuanyin;
    }

    @Basic
    @Column(name = "th_zhuangtai", nullable = true, length = 200)
    public String getThZhuangtai() {
        return thZhuangtai;
    }

    public void setThZhuangtai(String thZhuangtai) {
        this.thZhuangtai = thZhuangtai;
    }

    @Basic
    @Column(name = "th_fangshi", nullable = true, length = 200)
    public String getThFangshi() {
        return thFangshi;
    }

    public void setThFangshi(String thFangshi) {
        this.thFangshi = thFangshi;
    }

    @Basic
    @Column(name = "th_wuliugs", nullable = true, length = 200)
    public String getThWuliugs() {
        return thWuliugs;
    }

    public void setThWuliugs(String thWuliugs) {
        this.thWuliugs = thWuliugs;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tuihuo tuihuo = (Tuihuo) o;
        return thId == tuihuo.thId &&
                Objects.equals(thDanhao, tuihuo.thDanhao) &&
                Objects.equals(thTime, tuihuo.thTime) &&
                Objects.equals(thYingmoney, tuihuo.thYingmoney) &&
                Objects.equals(thShimoney, tuihuo.thShimoney) &&
                Objects.equals(thYuanyin, tuihuo.thYuanyin) &&
                Objects.equals(thZhuangtai, tuihuo.thZhuangtai) &&
                Objects.equals(thFangshi, tuihuo.thFangshi) &&
                Objects.equals(thWuliugs, tuihuo.thWuliugs);
    }

    @Override
    public int hashCode() {
        return Objects.hash(thId, thDanhao, thTime, thYingmoney, thShimoney, thYuanyin, thZhuangtai, thFangshi, thWuliugs);
    }

    @ManyToOne
    @JoinColumn(name = "k_id", referencedColumnName = "k_id")
    public Kehu getkH() {
        return kH;
    }

    public void setkH(Kehu kH) {
        this.kH = kH;
    }

    @ManyToOne
    @JoinColumn(name = "dd_id", referencedColumnName = "dd_id")
    public Dingdan getDingdanByDdId() {
        return dingdanByDdId;
    }

    public void setDingdanByDdId(Dingdan dingdanByDdId) {
        this.dingdanByDdId = dingdanByDdId;
    }

    @ManyToOne
    @JoinColumn(name = "fh_id", referencedColumnName = "fh_id")
    public Fahuo getFahuo() {
        return fahuo;
    }

    public void setFahuo(Fahuo fahuo) {
        this.fahuo = fahuo;
    }
}
